feat(checkpoint): wire checkpointing into agent event loop - #2190
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Assessment: Comment This is a well-structured PR that wires checkpoint functionality into the agent loop with a clean opt-in design. The state machine is carefully reasoned and the integration tests (especially the crash-after-tools test) are compelling. Two themes warrant attention before merge: Review Themes
The feature design, state-machine logic, and durability proof are solid. The integration tests are particularly well-designed. |
|
Assessment: Comment Good progress since the last round — the New Review Items
The prior-round items around API review ( |
Description
Wires the
Checkpointdata model (landed in #2181) into the agent runtime so an opt-incheckpointing=Trueagent pauses at ReAct cycle boundaries and emits a serializable pause-point marker. The marker travels throughAgentResult.checkpointand is passed back to a fresh agent through acheckpointResumeblock. The design mirrors the existing interrupt pattern:stop_reason="checkpoint"to signal the pause, content-block resume, no new method surface to learn.A
Checkpointis a position marker (which boundary fired and which cycle index), not a state snapshot. State persistence is the caller's responsibility. The recommended pairing is aSessionManagerfor state continuity pluscheckpointing=Truefor boundary signalling.User-facing API (zero breaking changes — opt-in only):
V0 known limitations:
OpenAIResponsesModel(stateful=True)not supported.BeforeInvocationEvent/AfterInvocationEventfire on every resume (same as interrupts).ToolExecutor. The SDK checkpoint operates at cycle boundaries.Related Issues
Documentation PR
Type of Change
New feature
Testing
Verified the changes do not break functionality or introduce warnings in consuming repositories.
hatch run prepareEvidence from fresh runs:
hatch test— 3026 passed, 4 skipped, 0 failed.hatch run hatch-static-analysis:lint-check—ruff checkandmypyboth clean.hatch run hatch-static-analysis:format-check— all files formatted.\Checklist
agent-docs; module-level docstring incheckpoint.pycovers V0 limitations, precedence rules, and the recommended SessionManager pairing)main; this PR builds on it)By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.